Conversation
2f27bcb to
94d2bf5
Compare
cardano-api/src/Cardano/Api/Experimental/Tx/Internal/BodyContent/New.hs
Outdated
Show resolved
Hide resolved
a4bf7e5 to
b849b1e
Compare
b849b1e to
5595edb
Compare
6f0764f to
294ecd9
Compare
294ecd9 to
b210b64
Compare
palas
left a comment
There was a problem hiding this comment.
Looks good 👍. Just a typo and a suggestion
| substitudeExecUnitsTxMint | ||
| :: ScriptWitnessIndex | ||
| -> AnyScriptWitness (LedgerEra era) | ||
| -> Either (TxBodyErrorAutoBalance (LedgerEra era)) (AnyScriptWitness (LedgerEra era)) | ||
| substitudeExecUnitsTxMint _ w@AnyScriptWitnessSimple{} = Right w | ||
| substitudeExecUnitsTxMint idx (AnyScriptWitnessPlutus psw) = |
There was a problem hiding this comment.
| substitudeExecUnitsTxMint | |
| :: ScriptWitnessIndex | |
| -> AnyScriptWitness (LedgerEra era) | |
| -> Either (TxBodyErrorAutoBalance (LedgerEra era)) (AnyScriptWitness (LedgerEra era)) | |
| substitudeExecUnitsTxMint _ w@AnyScriptWitnessSimple{} = Right w | |
| substitudeExecUnitsTxMint idx (AnyScriptWitnessPlutus psw) = | |
| substituteExecUnitsTxMint | |
| :: ScriptWitnessIndex | |
| -> AnyScriptWitness (LedgerEra era) | |
| -> Either (TxBodyErrorAutoBalance (LedgerEra era)) (AnyScriptWitness (LedgerEra era)) | |
| substituteExecUnitsTxMint _ w@AnyScriptWitnessSimple{} = Right w | |
| substituteExecUnitsTxMint idx (AnyScriptWitnessPlutus psw) = |
Typo substitudeExecUnitsTxMint -> substituteExecUnitsTxMint
| [ (policyId, (assets,) <$> substitutedWitness) | ||
| | (ix, policyId, assets, wit) <- indexTxMintValue txMintValue' | ||
| , let substitutedWitness = substituteExecUnits ix wit | ||
| , let substitutedWitness = substitudeExecUnitsTxMint ix wit |
There was a problem hiding this comment.
| , let substitutedWitness = substitudeExecUnitsTxMint ix wit | |
| , let substitutedWitness = substituteExecUnitsTxMint ix wit |
Also here
| case Map.lookup idx exUnitsMap of | ||
| Nothing -> | ||
| Left $ TxBodyErrorScriptWitnessIndexMissingFromExecUnitsMap idx exUnitsMap | ||
| Just exunits -> | ||
| Right $ | ||
| AnyScriptWitnessPlutus $ | ||
| updatePlutusScriptWitnessExecutionUnits exunits psw |
There was a problem hiding this comment.
This bit should probably be a separate function because it is identical to the bit in substituteExecUnits. Maybe substituteExecUnitsInPsw.
| newDatum :: L.Datum (LedgerEra era) <- obtainCommonConstraints (useEra @era) $ toLedgerDatum d | ||
| return $ obtainCommonConstraints (useEra @era) $ TxOut $ o & L.datumTxOutL .~ newDatum | ||
|
|
||
| newtype DatumDecodingError = DataDecodingError String |
There was a problem hiding this comment.
Why the type name and the constructor names are slightly different?
| proxyToAsType _ = AsConwayEra | ||
|
|
||
| instance HasTypeProxy L.DijkstraEra where | ||
| data AsType L.DijkstraEra = AsDijkstraEra |
There was a problem hiding this comment.
You have not exported the name constructors here. Additionally, there would be a name clash between definitions of our eras and ledger eras, since the constructors have the same name: https://github.com/IntersectMBO/cardano-api/blob/mgalazyn/proto-lens-ghc-9.12/cardano-api/src/Cardano/Api/Era/Internal/Core.hs#L108-L108
Perhaps it's the sign to switch to using ledger eras everywhere?
Changelog
Resolves:
TxOutdefinition can be refactored #1084UnsignedTx#1089Context
Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.
How to trust this PR
Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.
Checklist